package ejb.entity;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.*;


/**
 * The persistent class for the notification database table.
 * 
 */
@Entity
@Table(name="notification")
@NamedQueries({
	@NamedQuery(name="DefaultNotification.findAll", query="SELECT notification FROM DefaultNotification notification"),
	@NamedQuery(name="DefaultNotification.findById", query="SELECT notification FROM DefaultNotification notification where notification.id = :id"),
	@NamedQuery(name="DefaultNotification.findPositionNotifications", query="SELECT notification FROM DefaultNotification notification where notification.position = :pos")
})
public class DefaultNotification implements Serializable, Notification {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;

	private int maxpressure;

	private int maxtemperature;

	private String message;

	private int minpressure;

	private int mintemperature;

	private int type;
	
	private Timestamp last_send;
	
	private boolean already_send;
	
	private boolean one_time;

	//bi-directional many-to-one association to DefaultPosition
    @ManyToOne(targetEntity=DefaultPosition.class)
	@JoinColumn(name="position_id")
	private Position position;

    public DefaultNotification() {
    }

    public DefaultNotification(String message, int type, int mintemp, int maxtemp, int minpressure, int maxpressure, Position position, boolean one_time){
    	this.message = message;
    	this.type = type;
    	this.mintemperature = mintemp;
    	this.maxtemperature = maxtemp;
    	this.minpressure = minpressure;
    	this.maxpressure = maxpressure;
    	this.position = position;
    	this.one_time = one_time;
    }

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getId()
	 */
	@Override
	public int getId() {
		return this.id;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setId(int)
	 */
	@Override
	public void setId(int id) {
		this.id = id;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getMaxpressure()
	 */
	@Override
	public int getMaxpressure() {
		return this.maxpressure;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setMaxpressure(int)
	 */
	@Override
	public void setMaxpressure(int maxpressure) {
		this.maxpressure = maxpressure;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getMaxtemperature()
	 */
	@Override
	public int getMaxtemperature() {
		return this.maxtemperature;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setMaxtemperature(int)
	 */
	@Override
	public void setMaxtemperature(int maxtemperature) {
		this.maxtemperature = maxtemperature;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getMessage()
	 */
	@Override
	public String getMessage() {
		return this.message;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setMessage(java.lang.String)
	 */
	@Override
	public void setMessage(String message) {
		this.message = message;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getMinpressure()
	 */
	@Override
	public int getMinpressure() {
		return this.minpressure;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setMinpressure(int)
	 */
	@Override
	public void setMinpressure(int minpressure) {
		this.minpressure = minpressure;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getMintemperature()
	 */
	@Override
	public int getMintemperature() {
		return this.mintemperature;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setMintemperature(int)
	 */
	@Override
	public void setMintemperature(int mintemperature) {
		this.mintemperature = mintemperature;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getType()
	 */
	@Override
	public int getType() {
		return this.type;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setType(int)
	 */
	@Override
	public void setType(int type) {
		this.type = type;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getPosition()
	 */
	@Override
	public Position getPosition() {
		return this.position;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setPosition(ejb.entity.Position)
	 */
	@Override
	public void setPosition(Position position) {
		this.position = (DefaultPosition) position;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#getLast_send()
	 */
	@Override
	public Timestamp getLast_send() {
		return last_send;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setLast_send(java.sql.Timestamp)
	 */
	@Override
	public void setLast_send(Timestamp last_send) {
		this.last_send = last_send;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#isAlready_send()
	 */
	@Override
	public boolean isAlready_send() {
		return already_send;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.Notification#setAlready_send(boolean)
	 */
	@Override
	public void setAlready_send(boolean already_send) {
		this.already_send = already_send;
	}
	
	@Override
	public boolean isOne_time() {
		return one_time;
	}
	
	@Override
	public void setOne_time(boolean one_time) {
		this.one_time = one_time;
	}
	
}